CONBOY, J.
The petitioner, Merriam Farm, Inc., appeals a decision of the Superior Court (Kissinger, J.) dismissing its appeal of a decision of the Zoning Board of Adjustment (ZBA) of the respondent, Town of Surry (Town), on the basis that the appeal was barred by claim preclusion. We reverse and remand.
The trial court found, or the record supports, the following facts. The petitioner owns an unimproved parcel of land in Surry with frontage on a Class VI road. The property is approximately 1,000 feet from a Class V road. Under the Town's zoning ordinance, to build on its property, the petitioner must establish that the property has at least 200 feet of frontage on a public street, which is defined, in pertinent part, as a Class V or better road.
In 2009, the petitioner applied to the Town's selectboard, pursuant to RSA 674:41 (2008), for a building permit to construct a single-family home on the property. The selectboard denied the application because the property lacked frontage on a Class V or better road. See RSA 674:41, I. The petitioner appealed to the ZBA, and the ZBA denied relief. Subsequent appeals by the petitioner to the trial court and to this court were also unsuccessful. See Merriam Farm, Inc. v. Town of Surry, No. 2011-0311 (N.H. Sept. 12, 2012).
In 2013, the petitioner applied to the ZBA for a variance from the frontage requirement in the Town's zoning ordinance in order to build a single-family residence on the property. See RSA 674:33, I(b) (Supp. 2014). The ZBA denied the application. After unsuccessfully moving for rehearing, the petitioner appealed to the trial court.
The Town asserted, among other arguments, that the petitioner's application for a variance was barred by the doctrines of claim preclusion and preemption. The petitioner argued, among other things, that the Town waived its claim preclusion argument and that the ZBA improperly applied the statutory criteria governing variances under RSA 674:33, I(b).
Following a hearing, the trial court issued an order in which it determined that the Town did not waive its claim preclusion argument. The court then decided that the petitioner's previously unsuccessful application for a building permit under RSA 674:41 precluded the ZBA from considering the petitioner's variance application. This appeal followed.
The petitioner first argues that the Town waived its right to raise the issue of claim preclusion because it failed to raise the issue in a motion for rehearing before the ZBA. See RSA 677:3, I (2008). The petitioner also argues that, "[e]ven if the Town did not waive its right to raise the issue of preclusion, the [p]etitioner's application for a variance . . . is not precluded by its prior application for relief filed under RSA 67[4]:41." Because we agree that claim preclusion does not bar the petitioner's variance application, we need not address whether the Town waived its right to raise the claim preclusion issue.
To determine whether the doctrine of claim preclusion, otherwise known as res judicata, applies here, we employ the familiar three-part test. See In re Estate of Bergquist, 166 N.H. 531, 535, 100 A.3d 510 (2014); Gray v. Kelly, 161 N.H. 160, 164, 13 A.3d 848 (2010). This doctrine prevents parties from relitigating matters actually litigated and matters that could have been litigated in the first action, and it applies if three elements are met: "(1) the parties are the same or in privity with one another; (2) the same cause of action was before the court in both instances; and (3) the first action ended with a final judgment on the merits." Bergquist, 166 N.H. at 534-35, 100 A.3d 510 (quotation omitted). "The applicability of res judicata is a question of law, which we review de novo." Id. at 535, 100 A.3d 510 (quotation omitted).
The parties agree that the first and third elements of the res judicata test are met and dispute only whether the second element is met. Accordingly, we must determine only whether the petitioner's variance appeal constitutes the same cause of action as its prior building permit appeal.
The term "cause of action" is defined as the right to recover, regardless of the theory of recovery. Meier v. Town of Littleton, 154 N.H. 340, 343, 910 A.2d 1243 (2006) (quotation omitted); see Sleeper v. Hoban Family P'ship, 157 N.H. 530, 534, 955 A.2d 879 (2008) (defining "cause of action collectively to refer to all theories on which relief could be claimed on the basis of the factual transaction in question" (quotation omitted)). "Generally, in determining whether two actions are the same cause of action for the purpose of applying res judicata, we consider whether the alleged causes of action arise out of the same transaction or occurrence." Sleeper, 157 N.H. at 534, 955 A.2d 879 (quotation and brackets omitted). Res judicata will bar a second action even though the petitioner is prepared in the second action to present evidence or grounds or theories of the case not presented in the first action. Id.
To support its argument that res judicata precludes the petitioner's claim, the Town relies upon our decision in Shepherd v. Town of Westmoreland, 130 N.H. 542, 543 A.2d 922 (1988). In Shepherd, the
Unlike the constitutional and inverse condemnation claims in Shepherd that could, and should, have been brought when the plaintiff appealed the zoning board's denial of her variance, see id. at 544-45, 543 A.2d 922, the petitioner here could not have added the variance claim to its appeal of the ZBA's denial of its building permit application.
To obtain a building permit, the petitioner needed to demonstrate compliance with RSA 674:41. RSA 674:41 generally requires a showing that the lot upon which a building is proposed to be built has frontage on a Class V or better highway. See RSA 674:41, I(a). However, RSA 674:41 also allows for a building permit to be issued in other circumstances. For instance, the statute provides that a building permit may be issued when property has frontage on a Class VI highway if certain conditions are met. See RSA 674:41, I(c). The statute also establishes exceptions to its various requirements, including allowing for an appeal from the decision of the administrative officer to the ZBA whenever enforcement of the statute's provisions "would entail practical difficulty or unnecessary hardship" and permitting the ZBA to make a "reasonable exception" for the applicant. RSA 674:41, II.
In its prior appeal, the petitioner sought a "reasonable exception" pursuant to RSA 674:41, II. Thus, the petitioner was required to demonstrate that enforcement of the provisions in RSA 674:41 would have entailed "practical difficulty or unnecessary hardship." See RSA 674:41, II. It did not, however, also need to demonstrate, at that time, that it met all of the statutory requirements for a variance. In contrast to the plaintiff in Shepherd, who should have brought her constitutional and inverse condemnation claims when she appealed to the trial court, the petitioner could not have included variance issues in its trial court appeal of the ZBA's denial of its building permit application. This is so because the ZBA, as opposed to the trial court, decides in the first instance whether to issue a variance. See RSA 674:33 (Supp. 2014); see also Chester Rod & Gun Club v. Town of Chester, 152 N.H. 577, 583-84, 883 A.2d 1034 (2005) (remanding to ZBA to determine, in first instance, whether requirements necessary for grant of variance were met and determining that trial court erred, in part, by ordering ZBA to grant variance where ZBA had made no findings as to certain variance requirements). Accordingly, the petitioner needed to bring its variance application before the ZBA in an action separate from its appeal to the trial court of the denial of its building permit application. Under such circumstances, res judicata is inapplicable to the petitioner's variance application.
Accordingly, we conclude that the denial of the petitioner's application for a building permit gave rise to a cause of action different from the denial of its variance application, and, thus, res judicata did not preclude the petitioner's variance application. Therefore, we reverse the trial court's ruling.
To the extent that the Town additionally suggests that our decision in Brandt applies because the petitioner filed successive variance applications, we disagree. See Brandt Dev. Co. of N.H., 162 N.H. at 556, 34 A.3d 593. Here, the petitioner filed only one variance application.
The Town further argues that the doctrine of preemption precludes the petitioner from seeking a variance and contends that the ZBA properly denied the petitioner's variance application on the merits. However, because the trial court did not address these issues after it concluded that the case could be resolved based upon claim preclusion, we decline to address these issues in the first instance, and accordingly remand them to the trial court.
Reversed and remanded.
DALIANIS, C.J., and HICKS, LYNN, and BASSETT, JJ., concurred.